import { requestWithErrorHandling } from "./request";

// 上传图片到服务器，返回图片url
export function uploadImage(file) {
  const formData = new FormData();
  formData.append("file", file);
  return requestWithErrorHandling({
    url: "/upload/image",
    method: "POST",
    data: formData,
    headers: { "Content-Type": "multipart/form-data" },
    errorMessage: "上传图片失败",
  });
}
